import { createRouter, createWebHistory } from 'vue-router'
import HomePage from '../views/home/HomePage.vue'
import LoginSignPage from '@/views/login-sign/Login-SignPage.vue'
import PersonalCenterPage from '@/views/personal-center/Personal-CenterPage.vue'
import SelectivePage from '@/views/selective/SelectivePage.vue'
import CartPage from '@/views/cart/CartPage.vue'
import CommodityDetailPage from '@/views/commodity-detail/Commodity-DetailPage.vue'
import PayPage from '@/views/pay/PayPage.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'layout',
      component: () => import('../Layout/Layout.vue'),
      children: [
        {
          path: '',
          name: 'home',
          component: HomePage,
        },
        {
          path: 'login-sign',
          name: 'login-sign',
          component: LoginSignPage,
        },
        {
          path: 'personal-center',
          name: 'personal-center',
          component: PersonalCenterPage,
        },
        {
          path: 'cart',
          name: 'cart',
          component: CartPage,
        },
        {
          path: 'selective',
          name: 'selective',
          component: SelectivePage,
        },
        {
          path: 'commodity-detail',
          name: 'commodity-detail',
          component: CommodityDetailPage,
        },
        {
          path: 'pay',
          name: 'pay',
          component: PayPage,
        },
      ],
    },
  ],
})

export default router
